{% extends 'admin/base.html' %}

{% block content %}
    <section class="content-header">
        <h1>微电影管理系统</h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 标签管理</a></li>
            <li class="active">添加标签</li>
        </ol>
    </section>
    <section class="content" id="showcontent">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">添加标签</h3>
                    </div>
                    <form role="form" method="post">
                        <div class="box-body">
                            {% with msgs = get_flashed_messages(category_filter=['ok']) %}
                                {% if msgs %}
                                    <div class="alert alert-success alert-dismissible">
                                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                        <h4><i class="icon fa fa-check"></i> 成功!</h4>
                                        {% for msg in msgs %}
                                            <p>{{ msg }}</p>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                            {% endwith %}

                            {% with msgs = get_flashed_messages(category_filter=['err']) %}
                                {% if msgs %}
                                    <div class="alert alert-danger alert-dismissible">
                                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                        <h4><i class="icon fa fa-ban"></i> 失败!</h4>
                                        {% for msg in msgs %}
                                            <p>{{ msg }}</p>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                            {% endwith %}

                            <div class="form-group">
                                {#<label for="input_name">标签名称</label>#}
                                {#<input type="text" class="form-control" id="input_name" placeholder="请输入标签名称！">#}
                                <label for="input_name">{{ form.name.label }}</label>
                                {{ form.name }}
                                {% for err in form.name.errors %}
                                    <div class="col-md-12" style="color: red">{{ err }}</div>
                                {% endfor %}
                            </div>
                        </div>
                        {{ form.csrf_token }}
                        <div class="box-footer">
                            {#<button type="submit" class="btn btn-primary">添加</button>#}
                            {{ form.submit }}
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
{% endblock %}

{% block js %}
    <script>
        // 激活菜单栏
        $(document).ready(function () {
            $("#g-2").addClass('active');
            $("#g-2-1").addClass('active');
        })
    </script>
{% endblock %}